
/*客户端 账号密码 base64 test2:永久，web：3分钟，test30秒。*/
const clientID= 'cGlnOnBpZw=='; // const clientID= 'd2ViOndlYg=='; // 'dGVzdDI6dGVzdDI=' test2:test2 ||  'd2ViOndlYg==' web:web  || 'dGVzdDp0ZXN0' test:test

// 统一网关地址
// const zuulHost= 'http://192.168.0.214:8784';    //214
const zuulHost= 'http://192.168.0.233:8784';    //233
// 认证服务器地址
// const authHost= 'http://localhost:9999';
// 前端服务器地址
// const webHost= 'http://localhost:80';
// const webHost= 'http://192.168.0.156:8214';  //8214
const webHost= 'http://192.168.0.156:8233';  //8233

// const developURL ='http://192.168.0.214';/*服务器214*/
const developURL ='http://192.168.0.233';/*服务器233*/
const gongzuoliuDK=':8081/' /*工作流*/
const tongxunDK =':8784/'  /*通讯录*/
const richengDK =':8085/'  /*日程*/
const tongxunJK = 'uaa/organization/';
//const developURL ='http://192.168.1.192';/*秀子*/
//const developURL ='http://192.168.1.183';/*英子*/
// >>>>>>>>>>>api管理
// api 管理
var apiServer = '/api';

// >>>>>>>>>>>app应用市场管理模块
// 数据管理
var marketDataBaseServer = '/m_dataBase';
// 市场管理
var marketManageServer = '/m_manage';
// 门户平台
var marketPlatformServer = '/m_platform';
// 开发
var markerDevelopersServer = '/m_developers';

// 统一用户管理 模块
var uamServer  = '/uaa';

// token URI
const tokenUri= zuulHost+uamServer+"/oauth/token";
/*登录*/
const getToken  = params => { return axios({
    url:tokenUri
    ,method:"POST"
    ,data:params
    ,headers: {'Authorization': 'Basic '+clientID,"Content-Type":"application/x-www-form-urlencoded"}
}) };

// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  api 管理 start  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

// provicer 操作
const pro_searchByCondition = params => { return funAxios("POST",zuulHost+apiServer+'/provider/searchByCondition', params ) };
const pro_add = params => { return funAxios("POST",zuulHost+apiServer+'/provider', params ).then(res => res); };
const pro_update = params => { return funAxios("PUT",zuulHost+apiServer+'/provider', params ).then(res => res); };
const pro_del = id => { return funAxios("DELETE",zuulHost+apiServer+'/provider/'+id ).then(res => res); };
const pro_countByCondition = params => { return funAxios("POST",zuulHost+apiServer+'/provider/countByCondition',params ).then(res => res); };

// serviceInfo 操作
const ser_searchByCondition = params => { return funAxios("POST",zuulHost+apiServer+'/serviceInfo/searchByCondition', params ).then(res => res); };
const ser_add = params => { return funAxios("POST",zuulHost+apiServer+'/serviceInfo', params ).then(res => res); };
const ser_update = params => { return funAxios("PUT",zuulHost+apiServer+'/serviceInfo', params ).then(res => res); };
const ser_del = id => { return funAxios("DELETE",zuulHost+apiServer+'/serviceInfo/'+id ).then(res => res); };
const ser_check = params => { return funAxios("POST",zuulHost+apiServer+'/serviceInfo/check',params ).then(res => res); };
const ser_changeOnLineStatus = params => { return funAxios("POST",zuulHost+apiServer+'/serviceInfo/changeOnLineStatus',params ).then(res => res); };
const ser_countByCondition = params => { return funAxios("POST",zuulHost+apiServer+'/serviceInfo/countByCondition',params ).then(res => res); };
const ser_countAllService = params => { return funAxios("POST",zuulHost+apiServer+'/serviceInfo/countAllService',params ).then(res => res.data); };
const ser_countTodayService = params => { return funAxios("POST",zuulHost+apiServer+'/serviceInfo/countTodayService',params ).then(res => res.data); };
const ser_countByLoction = params => { return funAxios("POST",zuulHost+apiServer+'/serviceInfo/serviceInfoCountByLoction',params ).then(res => res.data); };

// requester 操作
const req_searchByCondition = params => { return funAxios("POST",zuulHost+apiServer+'/requester/searchByCondition',params ).then(res => res); };
const req_add = params => { return funAxios("POST",zuulHost+apiServer+'/requester', params ).then(res => res); };
const req_update = params => { return funAxios("PUT",zuulHost+apiServer+'/requester', params ).then(res => res); };
const req_del = id => { return funAxios("DELETE",zuulHost+apiServer+'/requester/'+id ).then(res => res); };
const req_check = params => { return funAxios("POST",zuulHost+apiServer+'/requester/check',params ).then(res => res); };
const req_countByCondition = params => { return funAxios("POST",zuulHost+apiServer+'/requester/countByCondition',params ).then(res => res); };
const req_countByOrganization = params => { return funAxios("POST",zuulHost+apiServer+'/requester/requesterCountByOrganization',params ).then(res => res.data); };
const req_monthlyRequesterCount = params => { return funAxios("POST",zuulHost+apiServer+'/requester/monthlyRequesterCount',params ).then(res => res.data); };

// serviceRequseterAssociation 操作
const assoc_searchByCondition = params => { return funAxios("POST",zuulHost+apiServer+'/serviceRequesterAssociation/searchByCondition',params ).then(res => res); };
const assoc_add = params => { return funAxios("POST",zuulHost+apiServer+'/serviceRequesterAssociation', params ).then(res => res); };
// 关联关系一般情况没修改的必要
const assoc_update = params => { return funAxios("PUT",zuulHost+apiServer+'/serviceRequesterAssociation', params ).then(res => res); };
const assoc_del = (requesterId,serviceId) => { return funAxios("DELETE",zuulHost+apiServer+'/serviceRequesterAssociation/'+requesterId+'/'+serviceId ).then(res => res); };
const assoc_check = params => { return funAxios("POST",zuulHost+apiServer+'/serviceRequesterAssociation/check',params ).then(res => res); };

// InvokLog 操作
const invoLog_searchByCondition = params => { return funAxios("POST",zuulHost+apiServer+'/invokLog/searchByCondition',params ).then(res => res); };
const invoLog_del = id => { return funAxios("DELETE",zuulHost+apiServer+'/invokLog/'+id ).then(res => res); };
const invoLog_countByCondition = params => { return funAxios("POST",zuulHost+apiServer+'/invokLog/countByCondition',params ).then(res => res); };


// OperationLog 操作
const operLog_searchByCondition = params => { return funAxios("POST",zuulHost+apiServer+'/operationLog/searchByCondition',params ).then(res => res); };
const operLog_del = id => { return funAxios("DELETE",zuulHost+apiServer+'/operationLog/'+id ).then(res => res); };


// Dictionary 操作
const dict_getRootListByType = params => {return funAxios("POST",zuulHost+apiServer+'/dictionary/getRootListByType',params ).then(res => res);};
const dict_getSubNodeListByPid = params => {return funAxios("POST",zuulHost+apiServer+'/dictionary/getSubNodeListByPid',params ).then(res => res);};

//accesscontrol 操作
const acc_searchByCondition = params => { return funAxios("POST",zuulHost+apiServer+'/accessController/searchByCondition', params ).then(res => res); };
const acc_getAccessCtrlInfo = params => { return funAxios("POST",zuulHost+apiServer+'/accessController/getInfoByServiceId', params ).then(res => res); };
const acc_add = params => { return funAxios("POST",zuulHost+apiServer+'/accessController/addAccInfo', params ).then(res => res); };
const cusAcc_searchByCondition = params => { return funAxios("POST",zuulHost+apiServer+'/customController/searchByCondition', params ).then(res => res); };
const cusAcc_getInfo = params => { return funAxios("POST",zuulHost+apiServer+'/customController/getInfoBySerAndReqId', params ).then(res => res); };
const cus_acc_add = params => { return funAxios("POST",zuulHost+apiServer+'/customController/addCusAccInfo', params ).then(res => res); };

// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  api 管理 end  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  应用市场基础管理 start  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

// Market 操作

//根据条件获取列表
const getMarketList = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/market/condition', params ).then(res => res.data); };
//添加
const addMarket = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/market/addMarket', params ).then(res => res.data); };
//修改
const editMarket = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/market/editMarket', params ).then(res => res.data); };
//删除
const deleteMarket = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/market/deleteMarket', params ).then(res => res.data); };
//查询行政区划tree
const getAreaList = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/market/getAreaList', params ).then(res => res.data); };

// application-type 操作
//根据条件获取列表
const getApplicationTypeList = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/applicationType/condition', params ).then(res => res.data); };
const addApplicationType = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/applicationType/addApplicationType', params ,"multipart/form-data").then(res => res.data); };
//修改
const editApplicationType = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/applicationType/editApplicationType', params ).then(res => res.data); };
//删除
const deleteApplicationType = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/applicationType/deleteApplicationType', params ).then(res => res.data); };

// supplier 操作
//根据条件获取列表
const getSupplierList = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/supplier/condition', params ).then(res => res.data); };
//添加
const addSupplier = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/supplier/addSupplier', params ).then(res => res.data); };
//修改
const editSupplier = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/supplier/editSupplier', params ).then(res => res.data); };
//删除
const deleteSupplier = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/supplier/deleteSupplier', params ).then(res => res.data); };
// 分配用户
//获取已有权限的用户列表
const getSupplierUserList = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/supplierAllocation/getSupplierUserList', params ).then(res => res.data); };
//获取已有权限的市场列表
const getSupplierMarketList = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/supplierAllocation/getSupplierMarketList', params ).then(res => res.data); };
//获取已有权限的供应商列表
const getSupplierSupplierList = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/supplierAllocation/getSupplierSupplierList', params ).then(res => res.data); };
//分配用户/市场/关联供应商
const distribution = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/supplierAllocation/distribution', params ).then(res => res.data); };
//删除关联 用户关联
const deletesupplierAllocationByUser = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/supplierAllocation/deleteUser', params ).then(res => res.data); };
//删除关联 市场关联
const deletesupplierAllocationByMarket = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/supplierAllocation/deleteMarket', params ).then(res => res.data); };
//删除关联 供应商关联
const deletesupplierAllocationBySupperlier = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/supplierAllocation/deleteSupplier', params ).then(res => res.data); };
//关联查询  找出供应商已有权限的用户和未有权限的用户
const getUserListBySupplier = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/user/getListBySupplier', params ).then(res => res.data); };
//关联查询  找出供应商已有权限的市场和未有权限的市场
const getMarketListBySupplier = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/market/getListBySupplier', params ).then(res => res.data); };
//关联查询  找出供应商已有权限的供应商和未有权限的供应商
const getSupplierListBySupplier = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/supplier/getListBySupplier', params ).then(res => res.data); };
// file 文件操作
const uploadFile = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/file/upload', params,{headers:{'Content-Type':'multipart/form-data'}} ).then(res => res.data); };
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  应用市场基础管理 end  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  应用市场管理 start  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
// Market 操作
//根据条件获取列表
const getAppList = params => { return funAxios("POST",zuulHost+marketManageServer+'/appBaseInfo/appList', params ).then(res => res.data); };

const getExtendList = params => { return funAxios("POST",zuulHost+marketManageServer+'/appExtendInfo', params ).then(res => res.data); };

const getApiList = params => { return funAxios("POST",zuulHost+marketManageServer+'/apiInterface/list', params ).then(res => res.data); };

const versionList = params => { return funAxios("POST",zuulHost+marketManageServer+'/versionInfo/versionList', params ).then(res => res.data); };
const createApi = params => { return funAxios("POST",zuulHost+marketManageServer+'/apiInterface/create', params ).then(res => res.data); };

const createVersion = params => { return funAxios("POST",zuulHost+marketManageServer+'/versionInfo/create', params ).then(res => res.data); };
const updateVersion = params => { return funAxios("POST",zuulHost+marketManageServer+'/versionInfo/update', params ).then(res => res.data); };

const addApp = params => { return funAxios("POST",zuulHost+marketManageServer+'/appBaseInfo/add', params ).then(res => res.data); };
//修改
const editApp = params => { return funAxios("POST",zuulHost+marketManageServer+'/appBaseInfo/update', params ).then(res => res.data); };

const editApi = params => { return funAxios("POST",zuulHost+marketManageServer+'/apiInterface/update', params ).then(res => res.data); };
//删除
const deleteApi = params => { return funAxios("POST",zuulHost+marketManageServer+'/apiInterface/remove', params ).then(res => res.data); };
// const deleteMarket = params => { return funAxios("POST",zuulHost+marketDataBaseServer+'/market/deleteMarket', params ).then(res => res.data); };

const publishMarket = params => { return funAxios("POST",zuulHost+marketManageServer+'/publishMarket/marketList', params ).then(res => res.data); };

const getAllPublishMarket = params => { return funAxios("POST",zuulHost+marketManageServer+'/publishMarket/getAll', params ).then(res => res.data); };

const addPublishMarket = params => { return funAxios("POST",zuulHost+marketManageServer+'/publishMarket/create', params ).then(res => res.data); };

const removeMarket = params => { return funAxios("POST",zuulHost+marketManageServer+'/publishMarket/remove', params ).then(res => res.data); };

const getpublishMarketList = params => { return funAxios("POST",zuulHost+marketManageServer+'/publishMarket/list', params ).then(res => res.data); };

const sendObj = params => { return funAxios("POST",zuulHost+marketManageServer+'/appBaseInfo/publish', params ).then(res => res.data); };

const taskList = params => { return funAxios("POST",zuulHost+marketManageServer+'/syncMission/taskList', params ).then(res => res.data); };

const addAuth = params => { return funAxios("POST",zuulHost+marketManageServer+'/authorize/create', params ).then(res => res.data); };

const delAuth = params => { return funAxios("POST",zuulHost+marketManageServer+'/authorize/remove', params ).then(res => res.data); };

const getAuth = params => { return funAxios("POST",zuulHost+marketManageServer+'/authorize/list', params ).then(res => res.data); };

const doAuthDept = params => { return funAxios("POST",zuulHost+marketManageServer+'/appBaseInfo/deptFromAuth', params ).then(res => res); };

const deptList = params => { return funAxios("POST",zuulHost+marketManageServer+'/authorize/deptList', params ).then(res => res); };

const userList = params => { return funAxios("POST",zuulHost+marketManageServer+'/authorize/userList', params ).then(res => res); };

const appList = params => { return funAxios("POST",zuulHost+marketManageServer+'/authorize/appList', params ).then(res => res); };

const AuthUser = params => { return funAxios("POST",zuulHost+marketManageServer+'/authorize/authToUser', params ).then(res => res); };

const cancleAuthUser = params => { return funAxios("POST",zuulHost+marketManageServer+'/authorize/cancleAuthToUser', params ).then(res => res); };
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  应用市场管理 end  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  统一用户管理 start  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//根据条件获取部门列表
const getOrganizationList = params => { return funAxios("POST",zuulHost+uamServer+'/organization/queryByCondition', params ).then(res => res); };
const getMyOrgsList = params => { return funAxios("POST",zuulHost+uamServer+'/organization/myOrgs', params ).then(res => res); };
//添加部门
const addOrganization = params => { return funAxios("POST",zuulHost+uamServer+'/organization/save', params ).then(res => res); };
//修改部门
const editOrganization = params => { return funAxios("POST",zuulHost+uamServer+'/organization/update', params ).then(res => res); };
//删除部门
const deleteOrganization = orgId => { return funAxios("POST",zuulHost+uamServer+'/organization/delete/'+orgId+'' ).then(res => res); };

//根据条件获取角色列表
const getRoleList = params => { return funAxios("POST",zuulHost+uamServer+'/role/list', params ).then(res => res); };
//添加角色
const addRole = params => { return funAxios("POST",zuulHost+uamServer+'/role/save', params ).then(res => res); };
//编辑角色
const editRole = params => { return funAxios("POST",zuulHost+uamServer+'/role/update', params ).then(res => res); };
//删除角色
const deleteRole = id => { return funAxios("POST",zuulHost+uamServer+'/role/del/'+id+'' ).then(res => res); };

// 按给定条件搜索权限信息（资源）
const searchPermission = params => { return funAxios("POST",zuulHost+uamServer+'/permission/search', params ) };
// 查询某角色 的权限列表（资源）
const getRolePermissions = params => { return funAxios("POST",zuulHost+uamServer+'/permission/searchByRoleId/'+params,{} ) };
// 更新某个角色的资源权限
const addPermissionsForRole = params => { return funAxios("POST",zuulHost+uamServer+'/permission/addForRole/',params ) };

//获取用户列表
const getUserList = params => { return funAxios("POST",zuulHost+uamServer+'/user/list', params ).then(res => res.data); };
//获取 自己的 用户列表
const getMyUserlist = params => { return funAxios("POST",zuulHost+uamServer+'/user/myUserlist', params ).then(res => res.data); };
//获取部门tree
const getree = params => { return funAxios("POST",zuulHost+uamServer+'/organization/tree', params ).then(res => res.data); };
//获取我的部门tree
const geMytree = params => { return funAxios("POST",zuulHost+uamServer+'/organization/mytree', params ).then(res => res.data); };
//添加用户
const addUser = params => { return funAxios("POST",zuulHost+uamServer+'/user/save', params ).then(res => res); };
//修改用户
const editUser = params => { return funAxios("POST",zuulHost+uamServer+'/user/update', params ).then(res => res); };
//删除用户
const deleteUser = id => { return funAxios("POST",zuulHost+uamServer+'/user/del/'+id+'' ).then(res => res); };
//获取部门已授权用户数据
const departmentHave = params => { return funAxios("POST",zuulHost+uamServer+'/organization/searchByUserId', params ).then(res => res); };
//授权部门给用户
const departmentAuthorization = params => { return funAxios("POST",zuulHost+uamServer+'/organization/updateOrgsForUser', params ).then(res => res); };
//获取角色已授权用户数据
const roleHave = id => { return funAxios("POST",zuulHost+uamServer+'/role/searchByuserId/'+id+'' ).then(res => res); };
//授权角色给用户
const addRolesForUser = params => { return funAxios("POST",zuulHost+uamServer+'/role/addRolesForUser', params ).then(res => res); };
//获取字典列表
const getDictionaryList = params => { return funAxios("POST",zuulHost+uamServer+'/dictionary/list', params ).then(res => res); };
const getDictionaryTree = params => { return funAxios("POST",zuulHost+uamServer+'/dictionary/tree', params ).then(res => res.data); };
//新增字典
const addDictionary = params => { return funAxios("POST",zuulHost+uamServer+'/dictionary/save', params ).then(res => res); };
//修改字典
const updateDictionary = params => { return funAxios("POST",zuulHost+uamServer+'/dictionary/update', params ).then(res => res); };
//删除字典
const deleteDictionary = id => { return funAxios("POST",zuulHost+uamServer+'/dictionary/delete/'+id+'' ).then(res => res); };

//查询所有菜单
const getMenuList = params => { return funAxios("POST",zuulHost+uamServer+'/menu/getList', params ).then(res => res); };
//查询已有权限的菜单
const searchMenuTreeByuserId = id => { return funAxios("POST",zuulHost+uamServer+'/menu/searchMenuTreeByuserId/'+id+'' ).then(res => res); };
//菜单授权给用户
const addMenuForUser = params => { return funAxios("POST",zuulHost+uamServer+'/userMenu/addMenuForUser', params ).then(res => res); };
